#ifndef __SSH_CLIENT_H
#define __SSH_CLIENT_H 1
#include <iostream>
#include <libssh/libssh.h>
using namespace std;
/**
 * 简单封装客户端的部分功能
 * @author: gtinlian
 * @email: gtinlian@sina.com
*/
class SSHClient
{
public:
    string error;
    ssh_channel channel;
    ssh_session session;
    SSHClient(ssh_session session):session(session){};
    SSHClient(const char* host, const char* port, const char*  user, const char*  password);

    ssh_channel get_channel();

    bool eq_channel(ssh_channel channel){
        return this->channel == nullptr ? false :  channel == this->channel;
    }

    bool channel_status(){
        return ssh_channel_is_open(channel);
    }
    int get_fd(){
        return session == nullptr ? -1 : ssh_get_fd(session);
    }
    void free_poll_event(ssh_event event){
        if(session != nullptr )
            ssh_event_remove_session(event, session);
    }
    ~SSHClient();
    bool status();
};
#endif